'''
可迭代元素的操作
'''

list = [10,50,20,60,30]

# print("len(list): {},另外一个值{}".format(len(list) ,100     ))
print("len(list): {}".format(len(list )))
print("max(list): {}".format(max(list )))
print("min(list): {}".format(min(list )))
print("sum(list): {}".format(sum(list )))


tuple1 = (10,50,20,60,30)

print("len(tuple1): {}".format(len(tuple1 )))
print("max(tuple1): {}".format(max(tuple1 )))
print("min(tuple1): {}".format(min(tuple1 )))
print("sum(tuple1): {}".format(sum(tuple1 )))


# zip
print("zip   " * 20 )
aList =[1, 2, 3]
bList =[4, 5, 6]
for (a ,b ) in zip(aList, bList):
    print("a :{} ,b:{} ".format(a ,b))

# enumerate
print("======enumerate=======" * 5)
for item in enumerate('abcdef'):
    print(type(item) ,item)

print("======ptthon中元素的遍历=======" * 5)
a = ['a','b','c','d','e','f']
for i in a:
    print(i)


#  i  [0-5]
for i in range(len(a)):
    print(i,a[i])


for i,ele in enumerate(a):
    print(i,ele)

# list = []
# for i in range(100):
#     list.append(i)
# print(list)

# 列表的推导式
list = [i for i in range(100)]
print(list)


vec = [
    [1,2,3],
    [4,5,6],
    [7,8,9]]

# list2 = [num for elem in vec for num in elem]
# print(list2)
list2 = [];
for elem in vec:
    for num in elem:
        list2.append(num)
print(list2)





